<?php
/**
 * Created by PhpStorm.
 * User: tandunzhao
 * Date: 2018/5/31
 * Time: 上午10:39
 */

namespace App\Http\Controllers\Api\User\Transformers;


class UserBillTransformer
{

    public function transform($obj){
        return [
            'id' => (int)$obj->id,
            'amount' => (float)($obj->amount),
            'type'   =>  $obj->type,
            'title'   =>  $obj->title,
            'remark'   =>  $obj->remark,
            'task_id'   =>  (int)$obj->task_id,
            'order_id'   =>  (int)$obj->order_id,
            'pay_withdraw_cash_id'   =>  (int)$obj->pay_withdraw_cash_id,
            'created_time'   =>  isset($obj->created_at) ? ($obj->created_at ? date('Y-m-d H:i:s', strtotime($obj->created_at)) : "") : "",
            'updated_time'   =>  isset($obj->updated_at) ? ($obj->updated_at ? date('Y-m-d H:i:s', strtotime($obj->updated_at)) : "") : "",
        ];
    }
}